module.exports = {
  handleTime(time, type) {
    if (time === 0) {
      return ' '
    }
    let date = new Date(parseInt(time) * 1000)
    let y = date.getFullYear()
    let m = date.getMonth() + 1
    m = m < 10 ? '0' + m : m
    let d = date.getDate()
    d = d < 10 ? '0' + d : d
    let h = date.getHours()
    let minute = date.getMinutes()
    h = h < 10 ? '0' + h : h
    minute = minute < 10 ? '0' + minute : minute
    if (type == 'date') {
      return y + '-' + m + '-' + d
    } else {
      return y + '-' + m + '-' + d + ' ' + h + ':' + minute
    }
  }
}
